//
//  WebAPI.h
//  WeChatHelper
//
//  Created by bang yi bang on 14-3-20.
//  Copyright (c) 2014年 bang yi bang. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "AFHTTPRequestOperationManager.h"

#define kUrl @"http://ping.vsmu.cn/app/Interface"




typedef void (^WebAPIBlockRequest)(NSInteger state,AFHTTPRequestOperation *operation, id responseObject);


@interface WebAPI : NSObject
{
    WebAPIBlockRequest _complete;
}
//@property (nonatomic , readonly) AFHTTPRequestOperationManager *manager;
// 实例
+ (WebAPI *) defaultManager;

//设置解析器
- (void) setResponseSerializer:(AFHTTPResponseSerializer *) serializer;

// 设置http header
- (void) setHeader:(NSString *)value forKey:(NSString *)key;

// post请求
- (void) postWebAPI:(NSDictionary *)params withPath:(NSString *)path andMethodNode:(NSString *)node completed:(WebAPIBlockRequest)complete;

// get请求
- (void) getWebAPIWithUrl:(NSString *)url completed:(WebAPIBlockRequest)complete;
- (void) getWebAPIWithPath:(NSString *)path andParams:(NSDictionary *)params completed:(WebAPIBlockRequest)complete;
- (void) getWebAPIWithPath:(NSString *)path andParams:(NSDictionary *)params andMethodNode:(NSString *)node  completed:(WebAPIBlockRequest)complete;
- (void) getWebAPIWithParams:(NSDictionary *)params andMethodNode:(NSString *)node completed:(WebAPIBlockRequest)complete;

//登陆
- (void)logInWithUserName:(NSString *)name andPassword:(NSString *)password completed:(WebAPIBlockRequest)complete;

//屡次登录
-(void)loginIn:(NSString *)userName andPw:(NSString *)password;
@end
